#include "sha256.h"
#include <string.h>
#include <stdio.h>
#include <dirent.h>
int main(){
    char carr[1024];
    printf("input:");
    scanf("%s",carr);
    printf("str:%s\n",carr);
    uint32_t* iarr=(uint32_t*)expand(carr,strlen(carr));
    uint32_t out[8];
    calc_sha256(iarr,1,out);
    for(int i=0;i<8;++i){
        printf("H[%d]:%08x\n",i,out[i]);
    }
    printf("Print String to file:./str\n");
    FILE* strFile=fopen("./str","w");
    fprintf(strFile,carr);
    fclose(strFile);
    printf("Print String to file:./hex.txt\n");
    FILE* hexFile=fopen("./hex.txt","w");
    for(int i=0;i<strlen(carr);++i){
        fprintf(hexFile,"%x\n",(uint8_t)carr[i]);
    }
    fclose(hexFile);
}